package chess;

import java.awt.Point;
import java.util.ArrayList;
import java.util.List;

import chess.SpecialMove;

import menu.GameDisplayPanel;

public class RookPiece extends ChessPiece{
	
	public boolean canLeftCastle;
	public boolean canRightCastle;
	
	public RookPiece(boolean black, int x_, int y_) {
		super(black, x_, y_);
		
		canLeftCastle = false;
		canRightCastle = false;
		
		movePossibilities = new int[4][GameDisplayPanel.boardSize-1][2];
		
		for (int i = 1; i < GameDisplayPanel.boardSize; i++){
			movePossibilities[0][i-1][0] = i;
			movePossibilities[0][i-1][1] = 0;
			
			movePossibilities[1][i-1][0] = -i;
			movePossibilities[1][i-1][1] = 0;
			
			movePossibilities[2][i-1][0] = 0;
			movePossibilities[2][i-1][1] = i;
			
			movePossibilities[3][i-1][0] = 0;
			movePossibilities[3][i-1][1] = -i;
		}
		
		attackPossibilities = movePossibilities;
	}
	
	public String getName(){
		return "rook";
	}
	
	@Override 
	public List<SpecialMove> getSpecialMovePossibilities() {		
		List<SpecialMove> specialMoves = new ArrayList<SpecialMove>();
		if (canLeftCastle)
			specialMoves.add(new SpecialMove("rookleftcastle", new Point(x, y), new Point(x+4, y), new Point(x+3,y), SpecialMoveType.move));
		if (canRightCastle)
			specialMoves.add(new SpecialMove("rookrightcastle", new Point(x, y), new Point(x-4, y), new Point(x-4,y), SpecialMoveType.move)); 
		return specialMoves;
	}
}
